#include "sort_insert.h"
#include <stdio.h>

int main() {
    DTYPE arr[] = { 19, 17, 15, 42, 12, 16, 18, 4, 11, 13 };
    DTYPE ref[] = { 4, 11, 12, 13, 15, 16, 17, 18, 19, 42 };
    int n = sizeof(arr) / sizeof(arr[0]);

    int has_errors = 0;

    // printing the original array
    printf("Original array: ");
    for (int i = 0; i < n; i++) {
        printf("%d ", arr[i]);
    }

    sort_insert(arr);

    // printing the sorted array
    printf("\nSorted array: ");
    for (int i = 0; i < n; i++) {
        if (arr[i] != ref[i]) {
            has_errors++;
        }
        printf("%d ", arr[i]);
    }
    printf("\n");

    if (has_errors) {
        fprintf(stderr, "Benchmark results are incorrect\n");
        return -1;
    }

    printf("Success.\n");
    return 0;
}
